﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using Ymatou.API.Common;
using Ymatou.Evaluate.Seller.Model.ApiModel.Response.Opt;
using Ymatou.ServiceCenter;

namespace Ymatou.Evaluate.Seller.Model.ApiModel.Request.Opt
{

    /// <summary>
    /// 回复评价
    /// </summary>
    [Resource("evaluate.iapi.ymatou.com", "api/opt/EvaluateReply", Method.POST, ParameterBuildType.Json)]
    public class EvaluateReplyRequest : BaseRequestModel<EvaluateReplyResponse>
    {

        public override string ApiName { get { return "api/opt/EvaluateReply"; } }
        public override bool HttpGet { get { return false; } }

        /// <summary>
        /// 商品评价Id
        /// </summary>
        public int ProdEvalId { get; set; }

        /// <summary>
        /// 买手Id
        /// </summary>
        public int SellerId { get; set; }

        /// <summary>
        /// 回复内容
        /// </summary>
        public string ReplyComments { get; set; }

        public override void Validate()
        {
            const string errCode = "-1";
            if (SellerId <= 0)
            {
                throw new BussniessException(errCode, "非法买手Id");
            }
            if (ProdEvalId <= 0)
            {
                throw new BussniessException(errCode, "非法评价Id");
            }
            if (string.IsNullOrWhiteSpace(ReplyComments))
            {
                throw new BussniessException(errCode, "回复内容不能为空");
            }
            if (ReplyComments.Length >= 1000)
            {
                throw new BussniessException(errCode, "回复内容超过最大长度限制");
            }
            base.Validate();
        }
    }
}
